package timeDemo;

/**
* @author jie
* @version 创建时间：2018年2月5日 下午11:51:08
* 时间格式化
*/
public class Time2 {
	public static void main(String[] args) {
		String str = "1200";
	

		System.out.println(secondToTime(str));
	}

	private static String secondToTime(String str) {
		int seconds = Integer.parseInt(str);
		int temp = 0;
		StringBuffer sb = new StringBuffer();
		temp = seconds / 3600;
		sb.append((temp < 10) ? "0" + temp + ":" : "" + temp + ":");

		temp = seconds % 3600 / 60;
		sb.append((temp < 10) ? "0" + temp + ":" : "" + temp + ":");

		temp = seconds % 3600 % 60;
		sb.append((temp < 10) ? "0" + temp : "" + temp);
		return sb.toString();
	}
}
